package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppModelMonitoring;
import com.ep.modules.app.service.AppModelMonitoringService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/model_monitoring")
public class AppModelMonitoringController {
    @Autowired
    private AppModelMonitoringService appModelMonitoringService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appModelMonitoringService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppModelMonitoring appmodelmonitoring = appModelMonitoringService.getById(id);
        return R.ok().put("appmodelmonitoring", appmodelmonitoring);
    }

    @SysLog("保存AppModelMonitoring")
    @PostMapping("/save")
    public R save(@RequestBody AppModelMonitoring appmodelmonitoring) {
        ValidatorUtils.validateEntity(appmodelmonitoring);
        appModelMonitoringService.save(appmodelmonitoring);
        return R.ok();
    }

    @SysLog("修改AppModelMonitoring")
    @PostMapping("/update")
    public R update(@RequestBody AppModelMonitoring appmodelmonitoring) {
        ValidatorUtils.validateEntity(appmodelmonitoring);
        appModelMonitoringService.update(appmodelmonitoring);
        return R.ok();
    }

    @SysLog("删除AppModelMonitoring")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appModelMonitoringService.deleteBatch(ids);
        return R.ok();
    }
}